home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / PHONGSRC.ZIP / PHONG4.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-01-07  |  4.7 KB  |  93 lines

  1. {$G+
  2.     _______________________________________________________________________
  3.   /                                                                         \
  4.  |                                                                           |
  5.  |  Hello dudes! Here it is. The very sloooow environment mapper in pascal.  |
  6.  |                                                                           |
  7.  |  Firstly, I must thank Cono/Fiction for helping me out on a lot of sub-   |
  8.  |  jects. A lot of this code is optimized/revised code from Cono's old      |
  9.  |  routines, wich I learned from a lot. Because of him I got from WRITELN   |
  10.  |  to this in about two years. So BIG BIG thanx. This engine, as slow as    |
  11.  |  it is, was coded and tested on a 386dx/40. Yes yes, I need a new motha-  |
  12.  |  bored and stuff. Anyway, it has also been tested on a 486dx4/120, but    |
  13.  |  with a slow ISA video card (4200 CH/SEC), and it ran fine. On another    |
  14.  |  DX4/120, cono's computer it also ran fine, and even looked nice. I have  |
  15.  |  implemented some different environment maps, all PCX, converted with     |
  16.  |  BINOBJ. Pat1 is a nice yellow plastic, Pat2 is weird stuff. Pat3 is a    |
  17.  |  nice blue chrome, and Pat4 is some very light cloud like sphere. And     |
  18.  |  there's also SILVER, wich is very nice, and my favorite, Sphere2.        |
  19.  |                                                                           |
  20.  |  Well, it has a lot of bugs, and it isn't our final version. The SLINE    |
  21.  |  routine for example, is still pure pascal. And the QSORT routine only    |
  22.  |  sorts objects by Z value. But that's mainly why we released it, cos if   |
  23.  |  we would release a perfect working version, bugfree, with full docs,     |
  24.  |  coding wouldn't be fun anymore! Also, there are seperate pieces of code  |
  25.  |  in here, with different coding styles. Don't pay attention to that, we   |
  26.  |  coded it together, and we are both lame coders ;). Now stop reading this |
  27.  |  and go play!                                                             |
  28.  |                                                                           |
  29.  |  Contaction us:                                                           |
  30.  |                                                                           |
  31.  |  Inopia:                                                                  |
  32.  |                                                                           |
  33.  |  Rynring 74                                                               |
  34.  |  5152 RB                                                                  |
  35.  |  DRUNEN                                                                   |
  36.  |  Tel: 0416374613                                                          |
  37.  |  Fax: 0416377696                                                          |
  38.  |  E-mail : NL1AFX@CBPACKHV.XS4ALL.NL                                       |
  39.  |                                                                           |
  40.  |  If you decide to reach me by E-MAIL you'll have to wait at least a week  |
  41.  |  be4 the messy reaches me, and at least another week b4 it gets back to   |
  42.  |  you again. Sometimes it doesn't reach it's destination at all. (or some- |
  43.  |  times it doesn't even get send!, I mean you NiX!). So better snailmail.  |
  44.  |  You can also leave a messy at one of our boreds, but I don't call em that|
  45.  |  much, exept for SL1210. (yet).                                           |
  46.  |                                                                           |
  47.  |                                                SigneD : Inopia/Fiction    |
  48.  |/ \------------------------------------------------------------------------|
  49.   \ /______________________________________________________________________ /
  50. }
  51. Program SumSlowEnvironmentMappedTorusInPascal;
  52.  
  53. Uses Crt,VarUnit,GRUnit,MathUnit;
  54.  
  55. {Replace all pat2 with some other object file for different environment maps }
  56.  
  57. Procedure pat2; Far; External; {$L pat2.obj}
  58.  
  59. Procedure Init;
  60. Begin
  61.   For I := 0 To 360 Do Costab[i] := round(Cos(i*(pi/180))*256);
  62.   For I := 0 To 360 Do Sintab[i] := round(Sin(i*(pi/180))*256);
  63.   GetMem(Buffer,64000); MyFill(Buffer^,64000,0);
  64.   GetMem(Emap,65534); MyFill(Emap^,65534,0);
  65.   Xpos := 160; Ypos := 100; zpos := -200;
  66.   Kickpcx2screen(@pat2,Emap^);
  67. End;
  68.  
  69. begin
  70.   Set320x200;
  71.   Init;
  72.   Calc_Normals;
  73.   repeat
  74.     Inc(Cnt);
  75.     Inc(XCnt,4); If XCnt > 359 then XCnt := 0;
  76.     Inc(YCnt,4); If YCnt > 359 then YCnt := 0;
  77.     Inc(ZCnt,3); If ZCnt > 359 then ZCnt := 0;
  78.     Rotate_Vertices;
  79.     Rotate_Normals;
  80.     Sort_Polyz;
  81.     Place_Polys;
  82.     MyMove(Buffer^,Mem[$A000:0],64000);
  83.     MyFill(Buffer^,64000,0);
  84.   Until KeyPressed;
  85.   FreeMem(Buffer,64000);
  86.   FreeMem(Emap,65534);
  87.   SetText;
  88. end.
  89.  
  90.  
  91.  
  92.  
  93.